<template>
  <ul class="rightList-container">
    <li v-for="(item, i) in list" :key="i" @click="handleClick(item)">
      <span class="name" :class="{ active: item.isSelect }">
        {{ item.name }}</span
      >
      <span class="aside" :class="{ active: item.isSelect }">{{
        item.aside
      }}</span>
      <RightList :list="item.children" @select="handleClick" />
    </li>
  </ul>
</template>

<script>
export default {
  name: "RightList",
  props: {
    list: {
      type: Array,
      require: true,
    },
  },
  methods: {
    handleClick(item) {
      if (!item.isSelect) {
        this.$emit("select", item);
      }
    },
  },
};
</script>

<style scoped lang="less">
@import "~@/styles/global.less";
.rightList-container {
  padding: 0 20px;
  li {
    min-height: 40px;
    line-height: 40px;
    font-size: 14px;
    cursor: pointer;
    .aside {
      font-size: 12px;
      margin-left: 1em;
      color: #b4b8bc;
    }
    .active {
      color: @danger;
      font-weight: 700;
    }
  }
}
</style>